<script setup>
import { useSendChatMessageStore } from '@/stores/sendChatMessage';
import audioRecordCard from '../card/audioRecordCard.vue'
import { isAudio } from '@/stores/loading'
import { userId } from '@/stores/user'
import { friendId } from '@/stores/friend'

//发送聊天信息
const sendChatMessage = useSendChatMessageStore()


</script>

<template>
    
  <div v-if="isAudio">
    <audioRecordCard :userId1=userId :userId2=friendId></audioRecordCard>
  </div>
  <div v-else>  
    <el-input
      v-model="sendChatMessage.content"
      style="width: 75vw; font-size:1.05em;"
      :rows="7"
      type="textarea"
      resize="none"
      position="fixed"
      left="25%"
      @keydown.enter.exact.prevent="sendChatMessage.send()"
    />
  <div v-if="sendChatMessage.content.length > 0">
    <el-button type="success" @click="sendChatMessage.send()">发送</el-button>
  </div>
  <div v-else>
    <el-button type="success" @click="sendChatMessage.send()" disabled>发送</el-button>
  </div>
  </div>
  </template>
  

<style scoped>
button{
    display:flex;
    position : fixed;
    width : 5vw;
    height : 4vh;
    left : 92%;
    bottom : 1%;
}
</style>

